$(".menu-box-bottom").click(function(e) {
	var className = $(this).attr('class');
	initializeAdd(e, className);
});
$(".feature-box-bottom").click(function(e) {
	var className = $(this).attr('class');
	initializeAdd(e, className);
});
$(".frame-box-bottom").click(function(e) {
	var className = $(this).attr('class');
	initializeAdd(e, className);
});
$(".footer-box-bottom").click(function(e) {
	var className = $(this).attr('class');
	initializeAdd(e, className);
});

function initializeAdd(e, className){
	var menuId = className.split(' ');
	var quantity = 1;
	var url = 'cart/cartController.php?ACTION=ADD&MENU_ID=' + menuId[1] + '&QUANTITY=' + quantity;
	var sumQuantitiy = ajx(url, '').trim();
	var o = {
	        left: e.pageX+'px',
	        top: e.pageY+'px'
	};
	$("#addCart").css('left', e.pageX+'px');
	$("#addCart").css('top', e.pageY+'px');
	openCart(sumQuantitiy);
}

function hideCart(sumQuantitiy){
	$('#addCart').animate({
		height: "0px",
		width: "0px"
	}, 100, function() {
		$('#cartCount').html(sumQuantitiy);
		if(sumQuantitiy > 0){
			$('#cartCount').css('display', 'block');
		}else{
			$('#cartCount').css('display', 'none');
		}
		$("#addCart").css('display', 'none');
	});
}

function moveCart(sumQuantitiy){
	$('#addCart').animate({
		left : "53%",
		top  : "110px"
	}, 1000 , function() {
		hideCart(sumQuantitiy);
	});
}
function openCart(sumQuantitiy){
	$("#addCart").css('display', 'block');
	$('#addCart').animate({
		height: "25px",
		width: "25px"
	}, 100 , function() {
		moveCart(sumQuantitiy);
	});
}